package com.meihuak.cloud_ordering.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.meihuak.cloud_ordering.bean.Student;
import com.meihuak.cloud_ordering.mapper.StudentMapper;
import com.meihuak.cloud_ordering.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService {
    @Autowired
    StudentService studentService;
    /**
     * @param openid
     * @return
     */
    @Override
    public Student getStudentByOpenid(String openid) {
        QueryWrapper<Student> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("openid",openid);
        List<Student> list = studentService.list(queryWrapper);
        return list.size()==0?null:list.get(0);
    }
}
